<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<#include '/common/head.html'>
	<script type="text/javascript">
		var $dg , $window, $obj={} ;
		$(function() {
			$dg = $('#dg').datagrid({
				title: '定时作业执行类字典',
				url: '/scheduler/classDict/list', method: 'GET', nowrap: true, striped: true, singleSelect: false,
				checkbox: true, pagination: true, pageSize: 30, pageList: [30,40,50,100,200,500,1000],
				autoRowHeight: true, fit: true, border: false, rownumbers: true, rownumberWidth: 40, toolbar: "#toolbars", 
				remoteSort: true, sortName: 'id', sortOrder: 'desc', queryParams: {},
				frozenColumns: [[
					{title: 'ID', field: 'id', hidden: true},
					{field: 'ck', checkbox:true}
				]],
				columns: [[
					{title: '字典名称', field: 'dictName', width: 100},
					{title: '字典标识', field: 'runningKey', width: 100},
					{title: '作业分组名', field: 'jobGroup', width: 100},
					{title: '作业全类名', field: 'className', width: 350},
					{title: 'Bean实例名称', field: 'beanName', width: 250},
					{title: '作业方法名', field: 'methodName', width: 150},
					{title: '备注信息', field: 'remarks', width: 250},
					{title: '创建时间', field: 'createTime', width: 130, align: 'center', sortable: true, formatter: function(value, row, index) {
						return value != null && value != '' ? $.date.format(value, 'yyyy-MM-dd HH:mm:ss') : '';
					}}
				]]
			});
		});
		
		$obj = {
			add: function() {
				$window = MM.addWindow({title: '添加', href: '/scheduler/classDict/form', width: 600, height: 350});
			},
			del: function() {
				var ids = MM.getSelectionsIds('#dg') ;
				if(ids) {
					$.messager.confirm('删除确认', '确定要删除？', function(r) {
						if(r) {
							$.get('/scheduler/classDict/delete/'+ids, function(result) {
								try {
									if(result.code == 200) {
										$obj.reload(); alertify.success(result.message);
									} else {
										alertify.warning(result.message);
									}
								} catch(e) {
									$.easyui.loaded(); console.error(e) ;
								}
							}, 'JSON').complete(function(){$.easyui.loaded();});
						}
					});
				} else {
					alertify.error('至少选择一条记录');
				}
			},
			update: function() {
				var row = $dg.datagrid('getSelected') ;
				if(null != row && row.id != "") {
					$window = MM.addWindow({title: '修改', href: '/scheduler/classDict/form?id='+row.id, width: 600, height: 320});
				} else {
					alertify.error('请选择一条记录');
				}
			},
			reload: function() {
				$dg.datagrid('reload'); $dg.datagrid('clearSelections');$dg.datagrid('clearChecked');
			}
		}
	</script>
	
</head>

<body>
	<div id="dg">
		<div id="toolbars"> 
			<a onclick="$obj.add();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-add'">添加</a> 
			<a onclick="$obj.update();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-edit'">编辑</a> 
			<a onclick="$obj.del();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-cancel'">删除</a> 
			<a onclick="$obj.reload();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-reload'">刷新</a> 
		</div>
	</div>
</body>
</html>
